package com.atguigu.gmall.item.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.service.ItemService;
import com.sun.org.apache.regexp.internal.RE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * author:atGuiGu-mqx
 * date:2022/4/28 14:36
 * 描述：
 **/
@RestController
@RequestMapping("/api/item/")
public class ItemApiController {

    @Autowired
    private ItemService itemService;

    //  /api/item/{skuId}
    @GetMapping("{skuId}")
    public Result getItem(@PathVariable Long skuId){
         // 调用服务层方法
         Map map = itemService.getItem(skuId);
         // 放入result
         return Result.ok(map);
    }

}